<template>
	<view>
		<view class="wallet-list" v-for="(item,index) in month" :key="index">
			<view class="top">
				<view class="title">{{item.name}}</view>
				<view class="right">
					<view class="mintitle" v-if="item.transfer==1"
						@click="onDetali(`/pageA/wallet/transfer?id=${item.id}&name=${item.name}`)">转账</view>
					<view class="mintitle" v-if="item.recharge==1"
						@click="onDetali(`/pageA/wallet/onchargecost?id=${item.id}&name=${item.name}&code=${item.code}`)">
						充值</view>
					<view class="mintitle" v-if="item.withdrawal==1"
						@click="onDetali( `/pageA/wallet/withdrawal?id=${item.id}&name=${item.name}`)">提现</view>
				</view>
			</view>
			<view class="bottom">
				<view class="num">{{item.money}}</view>
				<view class="more" @click="onDetali(`/pageA/wallet/walletdetail?id=${item.id}&name=${item.name}`)">查看明细
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				month: {
					money: '--',
					balance: '--',
					charges: '--',
					point: '--',
					score: '--',
					shopping: '--',
				}
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			// 初始化
			init() {
				this.getList()
			},
			// 获取数据
			getList() {
				this.$fun.ajax.post('user/balance', {}).then(res => {
					this.month = res.data
				})
			},
			// 查看详情
			onDetali(url) {
				this.$fun.jump(url)
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #F2EDED;
	}

	.wallet-list {
		width: 700upx;
		margin: 25upx auto;
		background: #fff;
		border-radius: 10upx;
		padding: 39upx 39upx 45upx 39upx;
		box-sizing: border-box;

		.top {
			display: flex;
			justify-content: space-between;

			.title {
				color: #343434;
				font-size: 26upx;
			}

			.right {
				display: flex;

				.mintitle {
					color: #666;
					margin-left: 35upx;
					font-size: 26upx;

					&:nth-child(1) {
						margin-left: 0;
					}
				}
			}
		}

		.bottom {
			display: flex;
			justify-content: space-between;
			margin-top: 40upx;

			.num {
				color: #FF5000;
				font-size: 46upx;
			}

			.more {
				color: #a1a1a1;
				font-size: 26upx;
				margin-top: 20upx;
			}
		}
	}
</style>